CC = gcc
CC_FLAGS = -g -m64 -std=c99 -Wall -pedantic-errors -DUSE_HP
CC_CAS = `pkg-config --cflags glib-2.0`
CC_GTHREAD = `pkg-config --libs gthread-2.0`

OBJECTS = MemoryManager.o
TEST1 = mainEnqDeqTest.c 

####################### TESTS ######################

all: WFQ.exe optWFQ.exe LockQ.exe LFQ.exe TEST

####################### End-Deq test ######################
WFQ.exe: ${OBJECTS}
	${CC} ${CC_FLAGS} -DUSE_WF_QUEUE ${CC_GTHREAD} \
	`pkg-config --cflags --libs glib-2.0` ${OBJECTS}  -o $@ \
	${TEST1} WFQueue.c

optWFQ.exe: ${OBJECTS}
	${CC} ${CC_FLAGS} -DUSE_optWF_QUEUE ${CC_GTHREAD} \
	`pkg-config --cflags --libs glib-2.0` ${OBJECTS}  -o $@ \
	${TEST1} optWFQueue.c
	
LockQ.exe: ${OBJECTS}
	${CC} ${CC_FLAGS} -DUSE_LOCK_QUEUE ${CC_GTHREAD} \
	`pkg-config --cflags --libs glib-2.0` ${OBJECTS}  -o $@ \
	${TEST1} LockQueue.c
	
LFQ.exe: ${OBJECTS}
	${CC} ${CC_FLAGS} -DUSE_HP_QUEUE ${CC_GTHREAD} \
	`pkg-config --cflags --libs glib-2.0` ${OBJECTS}  -o $@ \
	${TEST1} HPQueue.c

TEST: ${OBJECTS}
	${CC} ${CC_FLAGS} ${CC_GTHREAD} \
	`pkg-config --cflags --libs glib-2.0` ${OBJECTS}  -o $@ \
	Test.c

######################OBJECTS######################

MemoryManager.o: Node.h MemoryManager.c MemoryManager.h
	${CC} ${CC_FLAGS} ${CC_CAS} -c $*.c -o $@
				
######################Clean######################

clean:
	rm *.o 	WFQ.exe optWFQ.exe LFQ.exe LockQ.exe TEST

